<?php
namespace App\Utils\Service\Ly;
class WxLogin
{
    public static function getOpenidByCode($code)
    {
        $AppID=config('wxlogin.AppID');
        $AppSecret=config('wxlogin.AppSecret');
        $url="https://api.weixin.qq.com/sns/jscode2session?appid=$AppID&secret=$AppSecret&js_code=$code&grant_type=authorization_code";
        $arr=file_get_contents($url);
        $arr=json_decode($arr,true);
        return $arr;
    }
}
